<header class="demo-header">
    <div class="title3Left flt text-center header-small">
        <a href="javascript:history.back(-1);" class="whiteC">
        	<img src="/img/back.png" class="backimg">返回
        </a>
    </div>
    <div class="title3Middle flt text-center">立即支付</div>
    <div class="title3Right flt text-center"></div>
</header>
<?php $order_dateil = $this->order_dateil;
?>
<div class="graybg" style="padding-bottom: 3px;">
    <div class="whitebg">
		<div class="sizecolor">收货信息</div>
		<div class="message-detail paddingnot">
			<p style="padding-left: 7%;">
				联系人
				<input class="input" id="cnee" type="text" placeholder="请输入联系人" maxlength="30">
			</p>
			<p class="border1">
				联系电话
				<input class="input" id="cnee-tel" type="text" placeholder="请输入联系电话" maxlength="30">
			</p>
			<p  class="border1">
				收货地址
				<input class="input" id="cnee-addr" type="text" placeholder="请输入收货地址" maxlength="30">
                <input class="input" id="order_id" type="hidden" value="<?php echo $order_dateil['id']?>">
			</p>
			<p class="border1">
				备注信息
				<textarea class="beizhu-area" id="cnee-remark" type="text" placeholder="请输入备注信息" ></textarea>
			</p>
		</div>
	</div>
	<div class="whitebg">
		<div class="sizecolor flt" style="width: 40%;padding-right: 0;padding-bottom: 5px;">预约时间</div>
		<div class="flt text-right appointment_time" style="width: 53%;font-size: 0.75em;padding: 10px 0 0 0;" onclick="timeShow()">2016-10-22 16:20:10</div>
	</div>
    <div class="whitebg" style="padding-bottom: 0;">
		<div class="sizecolor">商品信息</div>
		<div class="border-two text-right zhemanjian" id="return-detail-prolist">
			<div class="product-list newproduct" style="padding-bottom: 0;border: none;">
				<?php if($order_dateil['dateil']){ ?>
					<?php foreach ($order_dateil['dateil'] as $key => $val){ ?>
						<div>
							<div class="newproimgdiv" style="padding-left: 0;">
								<img src="<?php echo $val['product']['img']['url'] ?>" class="img-width"/>
							</div>
							<div class="flt pline" style="line-height: 30px;">
								<p class="product"><?php echo $val['product']['name']?></p>
								<p style="font-weight: bold;">￥<?php echo $val['product']['unit_price']?></p>
							</div>
							<div class="gouxuan padding-adjust6 cuxiao-font">x<?php echo $val['amount']?></div>
						</div>
					<?php } ?>
				<?php } ?>
			</div>
		</div>
	</div>
	<div class="whitebg">
		<div class="sizecolor">支付信息</div>
	    <div class="shangxiapay border1">
			<p><div class="zonge flt nowrap">收款人：YOYO</div><div class="frt sizecolor grayarrow" style="padding-top: 3px;"><img src="/img/weixinicon.png" width="18px" height="18px" class="img-bottom"/></div></p>
		</div>
	</div>
	<div class="bottomBar" style="margin-bottom:0px;">
		<div class="pay-bottom-left">
			总计：<span style="font-weight:bolder;font-size: 1.3em;vertical-align: sup;">￥<span id="total"><?php echo $order_dateil['total_price']; ?></span></span>
		</div>
		<div onclick="pay()" class="tocount">
			立即支付
		</div>
	</div>
	<div id="fade" class="black_overlay" style="height: 123%;"></div>
	<div id="guige" class="timeguige text-center" style="width: 90%;left: 5%;bottom: 70px;">
		<div class="fontsize padding-adjust4 graybg" style="border-top-left-radius: 8px;border-top-right-radius: 8px;"><strong>请选择配送时间</strong></div>
		<div id="sese" style="height:260px ;overflow: auto;"></div>
		<div class="time-cofirm" onclick="CloseDiv();">确认</div>
	</div>
</div>
<script>
    function pay() {
        var contact = $('#cnee').val();
        var tel = $('#cnee-tel').val();
        var adds = $('#cnee-addr').val();
        var remark = $('#cnee-remark').val();
        var order_id = $('#order_id').val();
        var appointment_time = $('.appointment_time').text();
        if (!contact){
            layer.alert('请填写联系人!');return;
        }
        if (!tel){
            layer.alert('请填写联系电话!');return;
        }
        var partten =/^1[3|4|5|7|8]\d{9}$/;
        if(!partten.test(tel)){
            layer.alert('不是手机号码!');return;
        }
        if (!contact){
            layer.alert('请填写收货地址!');return;
        }
        if (!contact){
            layer.alert('请填写预约时间!');return;
        }
        $.ajax({
            type:'post',
            url : '/active/perpay',
            data :{
                'contact':contact,
                'tel':tel,
                'adds':adds,
                'remark':remark,
                'order_id':order_id,
                'appointment_time':appointment_time
            },
            dataType:'json',
            success:function(response){
                var res = response.message;
				if (res.order_id){
				   var url ='/active/success/?order_id='+res.order_id;
                   window.location.href = url;
               }else{
                   layer.alert('发起支付失败！'+res.order_id);return;
               }
               
            }
        });
    }
</script>